Skip to content

Fix: Update VM page to show memory in GB if > 1024MB#2425

Merged
limetech merged 2 commits into
unraid:masterfrom
SimonFair:Change-W11-VM-Defaults
Oct 16, 2025
Merged

Fix: Update VM page to show memory in GB if > 1024MB#2425
limetech merged 2 commits into
unraid:masterfrom
SimonFair:Change-W11-VM-Defaults

Conversation

@SimonFair

@SimonFair SimonFair commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved virtual machine memory display: allocations ≥1 GB now show in gigabytes (G), smaller allocations show in megabytes (M), with values rounded for clearer readability.
    • Ensures consistent unit selection for both running and stopped VMs so memory values are displayed uniformly across the UI.

@coderabbitai

coderabbitai Bot commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Changed VM memory display in VMMachines.php: memory is rounded, then shown with 'G' if rounded value ≥1024 MB, otherwise with 'M'. Source memory still computed from running VM memory or domain_get_memory, with unit selection based on the rounded value.

Changes

Cohort / File(s) Summary
Memory Display Formatting
emhttp/plugins/dynamix.vm.manager/include/VMMachines.php
Introduced intermediate memRounded = round(mem) and conditional unit selection: display as gigabytes (G) when memRounded >= 1024, otherwise as megabytes (M). Source memory computation unchanged (running VM memory or domain_get_memory(res) divided by 1024).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit hops through memory lanes,
Rounding bytes and counting gains,
If a thousand twenty-four is met,
Gigs appear without regret,
Else megabytes keep cozy reigns. 🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the primary change—displaying memory in GB for values above 1024 MB—matching the updated logic in VMMachines.php. It avoids unnecessary details and uses clear, specific phrasing that accurately conveys the fix.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e4d04d and 52d55a2.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix.vm.manager/include/VMMachines.php (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Oct 16, 2025

Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2025.10.16.0930
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2425/webgui-pr-2425.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix.vm.manager/include/VMMachines.php

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2425, or run:

plugin remove webgui-pr-2425

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce4653a and 5e4d04d.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix.vm.manager/include/VMMachines.php (1 hunks)

Comment thread emhttp/plugins/dynamix.vm.manager/include/VMMachines.php Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@ljm42 ljm42 added the 7.2 label Oct 16, 2025
@limetech limetech merged commit c7324fd into unraid:master Oct 16, 2025
2 checks passed
@SimonFair SimonFair deleted the Change-W11-VM-Defaults branch October 17, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants